<div class="blog-content">
    {if $posts}
    {foreach $posts as $p}
    <div class="post">
        <div class="post-title">
            <h5><a href="post.php?id={$p.id}" class="title">{$p.title}</a></h5>
            <span class="time">{date('d.m.Y H:i', $p.time)} by Aleksiev</span>
        </div>
        <div class="post-content">
            {$p.description}
        </div>
        <div class="post-meta">
            <span class="categories">
                Category <a href="blog.php?cat={$p.category}">{$categories[$p.category].name}</a> 
                Tags:
                {foreach $p.tags as $k => $t}
                <a href="blog.php?tag={$t}">{$t}</a>{if $k+1 < count($p.tags)},{/if}
                {/foreach}
            </span>
            <span class="post-comments"><a href="post.php?id={$p.id}">{$p.comments} comments</a></span>
        </div>
    </div>
    {/foreach}
    {else}
    <h3>No results found.</h3>
    
    <p>No results found for the search parameters.</p>
    {/if}
    
    {if $pagination.pages > 1}
    <div class="pagination">
        {if $pagination.current_page >= 3}<a href="blog.php?{if $uri}{$uri}&{/if}page=1" class="first">1</a>{/if}
        {if $pagination.current_page > 1}<a href="blog.php?{if $uri}{$uri}&{/if}page={$pagination.current_page - 1}">{$pagination.current_page - 1}</a>{/if}
        <a class="active {if $pagination.current_page == 1}first{/if}">{$pagination.current_page}</a>
        {if $pagination.current_page < $pagination.pages}<a href="blog.php?{if $uri}{$uri}&{/if}page={$pagination.current_page + 1}">{$pagination.current_page + 1}</a>{/if}
        {if $pagination.current_page + 1 < $pagination.pages}<a href="blog.php?{if $uri}{$uri}&{/if}page={$pagination.pages}">{$pagination.pages}</a>{/if}
    </div>
    {/if}
</div>
